home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part2 / 11219 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  705 b 

  1. Path: news.production.compuserve.com!news
  2. From: Dave Taylor <100440.2732@CompuServe.COM>
  3. Newsgroups: comp.lang.c
  4. Subject: Re: Beginer C please help me
  5. Date: 22 Mar 1996 17:36:19 GMT
  6. Organization: -
  7. Message-ID: <4iuoej$lm6$1@mhade.production.compuserve.com>
  8. References: <DoLCFx.B7x.0.bloor@torfree.net>
  9.  
  10. Sherif,
  11.  
  12. In answer to your 'C' question, Change the line:
  13.  
  14. n = (9/5)     to     n = (9.0/5.0)
  15.  
  16. your version divides 2 integers ( 9 & 5 ) so the result will 
  17. be an integer i.e. 1. When you use printf() to display your float
  18. with the format "1.3f" the 1 will be converted to 1.000 & then
  19. displayed. As a basic rule of thumb, try to avoid type mixing.
  20.  
  21. Rob.
  22. (also at: kbyec@westminster.ac.uk)
  23.  
  24. -- 
  25. Thanks Dave,
  26.